package cn.jee.controller;

import cn.jee.entity.Stu2;
import jakarta.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class ValidController {
  @RequestMapping("/valid_input")
  public String input(Stu2 stu2){
    return "/valid_input";
  }
  @RequestMapping("/valid_check")
  public String check(@Valid Stu2 stu2, BindingResult bindingResult){
    if(bindingResult.hasErrors()){
      return "/valid_input";
    }
    //repository.save(stu2);
    return "/valid_res";
  }
}
